package cn.itcast.mapper;

import cn.itcast.feign.pojo.Order;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface OrderMapper{
    @Select("select * from db08_homework.`order` where order_id = #{orderId}")
    Order selectById(Integer orderId);

    @Insert("insert into db08_homework.`order`(room_id, user_id, check_in_date, check_out_date, booking_days, room_price, deposit_status, order_status, order_price, user_name) " +
            "VALUES (#{roomId}, #{userId}, #{checkInDate}, #{checkOutDate}, #{bookingDays}, #{roomPrice}, #{depositStatus}, #{orderStatus}, #{orderPrice}, #{userName})")
    @Options(keyProperty = "orderId", useGeneratedKeys = true)
    void insert(Order order);

    List<Order> selectList(String userName, Integer roomPrice, Date startDate, Date endDate);
}
